<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Css3 知道宽高</title>
    <style>
        main{
            width: 500px;
            height: 500px;
            background-color: purple;
            position: relative;
        }
        article{
            width: 100px;
            height: 100px;
            background-color: cyan;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50px, -50px);
        }
    </style>
</head>
<body>
<main>
    <article></article>
</main>
</body>
</html>
